<?php


namespace app\log;


use app\drive\Idrive\ILogDrive;
use DI\Annotation\Inject;
use Doctrine\Common\Annotations\Annotation\Attribute;
use Doctrine\Common\Annotations\Annotation\Attributes;
use Doctrine\Common\Annotations\Annotation\Target;


class Log
{
    protected $level = 2;


    /**
     * @var ILogDrive $drive
     */
    protected $drive = null;

    /**
     * @Inject
     * @param ILogDrive $drive
     */
    public function setDrive(ILogDrive $drive)
    {
        $this->drive = $drive;
    }

    /**
     * @param $level
     */
    public function setLevel($level)
    {
        $this->level = $level;
    }

    public function info()
    {
        echo $this->drive->write();
        echo '开始写日志,当前日志等级:'.$this->level;
    }
}